package com.ruoyi.web.controller.solidDispose;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.solidDispose.domain.WxfwjcInfo;
import com.ruoyi.solidDispose.service.IWxfwjcInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 危险废物接受信息Controller
 * 
 * @author ruoyi
 * @date 2021-09-02
 */
@RestController
@RequestMapping("/solidDispose/wxfwjcInfo")
public class WxfwjcInfoController extends BaseController
{
    @Autowired
    private IWxfwjcInfoService wxfwjcInfoService;

    /**
     * 查询危险废物接受信息列表
     */
    @PreAuthorize("@ss.hasPermi('solidDispose:wxfwjcInfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(WxfwjcInfo wxfwjcInfo)
    {
        startPage();
        List<WxfwjcInfo> list = wxfwjcInfoService.selectWxfwjcInfoList(wxfwjcInfo);
        return getDataTable(list);
    }

    /**
     * 导出危险废物接受信息列表
     */
    @PreAuthorize("@ss.hasPermi('solidDispose:wxfwjcInfo:export')")
    @Log(title = "危险废物接受信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(WxfwjcInfo wxfwjcInfo)
    {
        List<WxfwjcInfo> list = wxfwjcInfoService.selectWxfwjcInfoList(wxfwjcInfo);
        ExcelUtil<WxfwjcInfo> util = new ExcelUtil<WxfwjcInfo>(WxfwjcInfo.class);
        return util.exportExcel(list, "危险废物接受信息数据");
    }

    /**
     * 获取危险废物接受信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('solidDispose:wxfwjcInfo:query')")
    @GetMapping(value = "/{wxfwjcId}")
    public AjaxResult getInfo(@PathVariable("wxfwjcId") Long wxfwjcId)
    {
        return AjaxResult.success(wxfwjcInfoService.selectWxfwjcInfoById(wxfwjcId));
    }

    /**
     * 新增危险废物接受信息
     */
    @PreAuthorize("@ss.hasPermi('solidDispose:wxfwjcInfo:add')")
    @Log(title = "危险废物接受信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WxfwjcInfo wxfwjcInfo)
    {
        return toAjax(wxfwjcInfoService.insertWxfwjcInfo(wxfwjcInfo));
    }

    /**
     * 修改危险废物接受信息
     */
    @PreAuthorize("@ss.hasPermi('solidDispose:wxfwjcInfo:edit')")
    @Log(title = "危险废物接受信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WxfwjcInfo wxfwjcInfo)
    {
        return toAjax(wxfwjcInfoService.updateWxfwjcInfo(wxfwjcInfo));
    }

    /**
     * 删除危险废物接受信息
     */
    @PreAuthorize("@ss.hasPermi('solidDispose:wxfwjcInfo:remove')")
    @Log(title = "危险废物接受信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{wxfwjcIds}")
    public AjaxResult remove(@PathVariable Long[] wxfwjcIds)
    {
        return toAjax(wxfwjcInfoService.deleteWxfwjcInfoByIds(wxfwjcIds));
    }
}
